import platform
import sys
import os


def print_system_info():
    print("\n=== 系统环境信息 ===")
    print(f"操作系统: {platform.system()} {platform.release()}")
    print(f"系统版本: {platform.version()}")
    print(f"机器类型: {platform.machine()}")
    print(f"Python版本: {sys.version}")
    print(f"Python路径: {sys.executable}")
    print(f"工作目录: {os.getcwd()}")


print_system_info()


def print_virtualenv_info():
    print("\n=== 虚拟环境信息 ===")
    print(
        f"是否在虚拟环境中: {'是' if hasattr(sys, 'real_prefix') or (hasattr(sys, 'base_prefix') and sys.base_prefix != sys.prefix) else '否'}")
    if hasattr(sys, 'real_prefix'):
        print("虚拟环境类型: virtualenv")
    elif hasattr(sys, 'base_prefix') and sys.base_prefix != sys.prefix:
        print("虚拟环境类型: venv")
    print(f"Python前缀路径: {sys.prefix}")


print_virtualenv_info()
